//
//  DXMLTimeOutObject.m
//  DerbyOSSampler
//
//  Created by glenn andreas on 3/9/14.
//  Copyright (c) 2014 glenn andreas. All rights reserved.
//

#import "DXMLTimeOutObject.h"

#import "DXMLPeriodObject.h"
#import "DXMLBoutObject.h"
#import "DXMLTeamObject.h"

@implementation DXMLTimeOutObject
- (NSString *) elementName
{
    return @"time-out";
}
- (DXMLPeriodObject *) period
{
    return [self enclosingParentOfClass:[DXMLPeriodObject class]];
}
- (DXMLBoutObject *) bout
{
    return [self enclosingParentOfClass:[DXMLBoutObject class]];
}
@synthesize team = _team;
- (void) setTeam:(DXMLTeamObject *)team
{
    _team = team;
    [self setAttribute:_team.name forKey:@"team"];
}
- (DXMLTeamObject *) team
{
    if (_team)
        return _team;
    NSString *teamName = [self attributeForKey:@"team"];
    for (DXMLTeamObject *team in self.bout.teams) {
        if ([team.name isEqualToString:teamName]) {
            _team = team;
            break;
        }
    }
    return _team;
}
@end

@implementation DXMLOfficialReviewObject
- (NSString *) elementName
{
    return @"official-review";
}


@end